package com.zhouu.example.member.manage.controller;

import com.zhouu.example.core.controller.BaseController;
import com.zhouu.example.core.message.Result;
import com.zhouu.example.member.manage.service.ManageSystemUserService;
import com.zhouu.example.member.manage.vo.request.SystemUserLoginRequest;
import com.zhouu.example.member.manage.vo.response.SystemUserLoginResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统用户
 *
 * @author zhouu
 * @date 2021-02-24 22:09
 */
@RestController
@RequestMapping("systemUser")
public class SystemUserController extends BaseController {

    private ManageSystemUserService manageSystemUserService;

    @Autowired
    private void setManageSystemUserService(ManageSystemUserService manageSystemUserService) {
        this.manageSystemUserService = manageSystemUserService;
    }

    /**
     * 系统用户登录
     *
     * @param request 登录参数
     * @return Result<SystemUserLoginResponse>
     */
    @RequestMapping(value = "login", method = RequestMethod.POST)
    public Result<SystemUserLoginResponse> login(@RequestBody SystemUserLoginRequest request) {
        SystemUserLoginResponse response = manageSystemUserService.login(request);
        return getSuccessResult(response);
    }
}
